package org.lsy.tlais.mapper;

import org.apache.ibatis.annotations.*;
import org.lsy.tlais.pojo.Dept;

import java.util.List;

@Mapper
public interface DeptMapper {

    //    查询所有部门
    @Select("select id, name, create_time, update_time from dept order by update_time desc")
    public List<Dept> findAll();

    //    删除部门
    @Delete("delete from dept where id = #{id}")
    public void delete(Integer id);

    //    新增部门
    @Insert("insert into dept(name, create_time, update_time) values(#{name}, #{createTime}, #{updateTime} )")
    public void insert(Dept dept);

    //    查询部门信息
    @Select("select * from dept where id = #{id}")
    Dept getInfo(Integer id);

    //    修改部门信息
    @Update("update dept set name= #{name} , update_time = #{updateTime} where id = #{id}")
    public void update(Dept dept);
}
